package com.qian.ddj.web.controller;


import com.qian.api.ddj.model.FaildOrderQueryModel;
import com.qian.api.ddj.model.PayFailed;
import com.qian.api.ddj.service.IPayFailedService;
import com.yaowk.api.common.PageReq;
import com.yaowk.api.common.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ddj/payFailed")
@Api(tags = "失败订单处理")
public class PayFailedController {
    @Autowired
    private IPayFailedService payFailedService;

    @GetMapping("/find")
    @ApiOperation("通过时间段,userId,outOrderNo查询")
    public PageResp<PayFailed> findByTime(final FaildOrderQueryModel model, PageReq pageReq){
        PageResp<PayFailed> pageResp = payFailedService.findAll(model, pageReq);
        return  pageResp;
    }

    @GetMapping("/{orderNo}")
    public PayFailed findOne(@PathVariable String orderNo) {
        PayFailed payFailed = new PayFailed();
        payFailed.setOutOrderNo(orderNo.toString());
        payFailed = payFailedService.findOne(payFailed);
        return payFailed;
    }


}
